package com.example.demo.Util;

import com.example.demo.po.User;

public class ThreadLocallUtil {
    public static final ThreadLocal<User> userThreadLocal = new ThreadLocal<>();
    /**
     * 获取当前用户
     * @return
     */
    public static User getUser() {
        return userThreadLocal.get();
    }
    /**
     * 设置当前用户
     * @param user
     */
    public static void setUser(User user) {
        userThreadLocal.set(user);
    }
    /**
     * 删除当前用户
     */
    public static void remove() {
        userThreadLocal.remove();
    }
}
